import QtQuick 2.9
import QtQuick.Controls 2.5

Rectangle {
    id: root
    border.color: "#2E75B6"
    border.width: 1

    property int min: 0
    property int max: 99
    property int value: 0

    Column {
        width: parent.width
        height: parent.height

        FlatButton {
            width:parent.width
            height: parent.height * 0.33
            radius: 0
            text: "+"

            onClicked: {
                if ( root.value < max) {
                     root.value++;
                }
            }
        }

        Label {
            width:parent.width
            height: parent.height * 0.33
            font.pixelSize: height * 0.4
            horizontalAlignment: Label.AlignHCenter
            verticalAlignment: Label.AlignVCenter
            text: root.value
        }

        FlatButton {
            width:parent.width
            height: parent.height * 0.33
            radius: 0
            text: "-"

            onClicked: {
                if ( root.value > min) {
                     root.value--;
                }
            }
        }

    }
}
